export const getTokenFromCookie = (req) => {
    if (!req.headers.cookie) return ""
    let tokenCookie = req.headers.cookie.split(';').find(c => c.trim().startsWith('access_token='))
    if(tokenCookie == undefined || tokenCookie == "") return ""
    let token = tokenCookie.split('=')[1]
    if(token == undefined || token=="") return ""
    return token
}

export const getTokenFromLocal = () => {
    const token = window.localStorage.access_token
    if(token == undefined || token=="") return ""
    return token;
}